import server from "../util/request.js";

export function getCustomerList() {
    return server({
        url: "/customer/list",
        method: "GET",
    });
}

// 搜索客户
export function searchCustomers(keyword) {
    return server({
        url: "/customer/search",
        method: "GET",
        params: { keyword },
    });
}

// 添加客户
export function addCustomer(data) {
    return server({
        url: "/customer/add",
        method: "POST",
        data,
    });
}

// 更新客户
export function updateCustomer(data) {
    return server({
        url: "/customer/update",
        method: "POST",
        data,
    });
}

// 删除客户
export function deleteCustomer(id) {
    return server({
        url: `/customer/delete/${id}`,
        method: "GET",
    });
}

// 停用客户
export function disableCustomer(id) {
    return server({
        url: `/customer/disable/${id}`,
        method: "GET",
    });
}

// 启用客户
export function enableCustomer(id) {
    return server({
        url: `/customer/enable/${id}`,
        method: "GET",
    });
}

// 根据 ID 获取客户详情
export function getCustomerById(id) {
    return server({
        url: `/customer/${id}`,
        method: "GET",
    });
}